package com.bawei.mall.search.controller;

import com.bawei.common.core.domain.R;
import com.bawei.mall.search.domain.Po.Brand;
import com.bawei.mall.search.domain.Po.BrandThumbsUp;
import com.bawei.mall.search.service.BrandService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author：liurui
 * @Package：com.bawei.mall.search.controller
 * @Project：mall_cloud
 * @name：UserProductController
 */
@RestController
@Log4j2
@RequestMapping("/brand")
public class BrandController {
    @Autowired
    private BrandService service;

    @GetMapping("/detail/{id}")
    public R<Brand> detail(@PathVariable Integer id){
        Brand brand=service.detail(id);
        return R.ok(brand);
    }

    @PostMapping("/delete")
    public R delete(@RequestParam Integer brandId){
        service.delete(brandId);
        return R.ok();
    }

    @PostMapping("/add")
    public R add(@RequestBody BrandThumbsUp brandThumbsUp){
        service.add(brandThumbsUp);
        return R.ok();
    }

    @GetMapping("/detailup")
    public R<BrandThumbsUp> detailup(@RequestParam Integer brandId){
        BrandThumbsUp brandThumbsUp=service.detailup(brandId);
        return R.ok(brandThumbsUp);
    }
}
